import base from '../../scripts/base'
import utils from '../../scripts/utils'
import './invites.css'
import Clipboard from 'clipboard'

// 清除页面来源展示
window.alert = function (name) {
    var iframe = document.createElement("IFRAME");
    iframe.style.display = "none";
    iframe.setAttribute("src", 'data:text/plain,');
    document.documentElement.appendChild(iframe);
    window.frames[0].window.alert(name);
    iframe.parentNode.removeChild(iframe);
};

var nickname = Request.nickname
var name = decodeURI(utils.getUrlString('nickname'))
var sheng = "..."
if (name.length > 4) name = name.substring(0, 4).concat(sheng);
document.getElementById('uid').value = utils.getUrlString('uid');
document.getElementById('nickname').innerHTML = decodeURI(name)

var clipboard = new Clipboard('.btn');
clipboard.on('success', function (e) {
    console.log(e);
    alert('已复制')
});
clipboard.on('error', function (e) {
    console.log(e);
    alert('复制错误请手动复制')
});